--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Commit edabbba041caf27c4cdfab8b4d48146a6cd7b0ac
Parents : 782dd5e
Author : Mark Qvist <mark@unsigned.io>
Date : 2025-11-24T15:23:45+01:00
Added multi-arch library builder
Changes
6 files changed, 68 insertions(+), 5 deletions(-)
Diff
diff --git a/.gitignore b/.gitignore
index e06420a..c24b52c 100755
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,4 @@ LXST/Utilities/LXST
RNS
__pycache__/*
LXST/__pycache__
+wheelhouse
diff --git a/Makefile b/Makefile
index b4b0a82..52298c4 100644
--- a/Makefile
+++ b/Makefile
@@ -2,8 +2,9 @@ all: release
clean:
@echo Cleaning...
- -rm -r ./build
- -rm -r ./dist
+ -sudo rm -rf ./build
+ -rm -rf ./dist
+ -rm -r ./LXST/__pycache__
remove_symlinks:
@echo Removing symlinks for build...
@@ -18,7 +19,19 @@ create_symlinks:
-ln -s ../LXST/ ./examples/LXST
build_wheel:
+ cp ./lib/0.4.2/* ./LXST/
python3 setup.py sdist bdist_wheel
+ -(rm ./LXST/*.so)
+ -(rm ./LXST/*.dll)
+ -(rm ./LXST/*.dylib)
+
+native_libs:
+ ./march_build.sh
+
+persist_libs:
+ -cp ./libs/dev/*.so ./libs/static/
+ -cp ./libs/dev/*.dll ./libs/static/
+ -cp ./libs/dev/*.dylib ./libs/static/
release: remove_symlinks build_wheel create_symlinks
diff --git a/build_wheels.sh b/build_wheels.sh
new file mode 100755
index 0000000..48df71d
--- /dev/null
+++ b/build_wheels.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# This script is used to run the binary wheel builds
+# inside docker containers for multi-arch compilation
+set -e -x
+
+yum install -y gcc gcc-c++ make codec2-devel codec2
+
+PYTHON_VERSIONS=(
+ "cp311-cp311"
+ "cp312-cp312"
+ "cp313-cp313"
+ "cp314-cp314"
+)
+
+for PY_TAG in "${PYTHON_VERSIONS[@]}"; do
+ PYBIN="/opt/python/${PY_TAG}/bin"
+
+ if [ ! -d "$PYBIN" ]; then
+ echo "Python version not found: $PYBIN"
+ continue
+ fi
+
+ echo "Building with: $PYBIN"
+ "${PYBIN}/pip" install cffi
+ "${PYBIN}/pip" wheel /io/ -w wheelhouse/
+done
\ No newline at end of file
diff --git a/fetch_libs.sh b/fetch_libs.sh
new file mode 100755
index 0000000..aef8f95
--- /dev/null
+++ b/fetch_libs.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+TARGET_DIR="${1:-./lib/dev}"
+mkdir -p "$TARGET_DIR"
+
+echo "Copying native libraries to $TARGET_DIR..."
+find ./build -name "filterlib*.*" -type f \( -name "*.so" -o -name "*.dll" -o -name "*.dylib" \) -exec cp {} "$TARGET_DIR/" \;
+
+echo "Done. Copied files:"
+ls -lh "$TARGET_DIR/"
\ No newline at end of file
diff --git a/march_build.sh b/march_build.sh
new file mode 100755
index 0000000..68425e3
--- /dev/null
+++ b/march_build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+docker run --rm -v $(pwd):/io quay.io/pypa/manylinux_2_34_x86_64 /io/build_wheels.sh
+docker run --rm -v $(pwd):/io quay.io/pypa/manylinux_2_31_armv7l /io/build_wheels.sh
+docker run --rm -v $(pwd):/io quay.io/pypa/manylinux_2_34_aarch64 /io/build_wheels.sh
+docker run --rm -v $(pwd):/io quay.io/pypa/manylinux_2_39_riscv64 /io/build_wheels.sh
+docker run --rm -v $(pwd):/io quay.io/pypa/musllinux_1_2_x86_64 /io/build_wheels.sh
+docker run --rm -v $(pwd):/io quay.io/pypa/musllinux_1_2_aarch64 /io/build_wheels.sh
+docker run --rm -v $(pwd):/io quay.io/pypa/musllinux_1_2_armv7l /io/build_wheels.sh
+docker run --rm -v $(pwd):/io quay.io/pypa/musllinux_1_2_riscv64 /io/build_wheels.sh
+
+./fetch_libs.sh
\ No newline at end of file
diff --git a/setup.py b/setup.py
index 2e7ac35..faeb282 100644
--- a/setup.py
+++ b/setup.py
@@ -4,12 +4,13 @@ from setuptools.command.build_ext import build_ext
import os
import platform
+BUILD_EXTENSIONS = True
+
with open("README.md", "r") as fh: long_description = fh.read()
exec(open("LXST/_version.py", "r").read())
-extensions = [
- Extension("LXST.filterlib", sources=["LXST/Filters.c"], include_dirs=["LXST"], language="c"),
-]
+if BUILD_EXTENSIONS: extensions = [ Extension("LXST.filterlib", sources=["LXST/Filters.c"], include_dirs=["LXST"], language="c"), ]
+else: extensions = []
packages = setuptools.find_packages(exclude=[])
packages.append("LXST.Utilities")
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────